package singleton;

/**
 * Created by head79 on 2017/7/12.
 */
public class LazySingleton {

    private static LazySingleton intance = null;

    //外界不能造对象 把无参构造方法私有
    private LazySingleton (){}

    //静态 同步
    public static  LazySingleton getInstance(){
        
       if(intance==null){
           synchronized(LazySingleton.class){
               intance = new LazySingleton();
           }
       }
       return intance;
    }
    public void  a(){
        EagerSingleton eagerSingleton= EagerSingleton.getInstance();
    }
}
